package com.station.administrators.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.open.capacity.common.model.FinanceModel;
import com.station.administrators.dao.FinanceDao;
import com.station.administrators.service.FinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author YangGang
 * @Title:
 * @Description: TODO
 * @date 2021/7/1/9:48
 */
@Service
public class FinanceServiceImpl implements FinanceService {
    @Autowired
    private FinanceDao financeDao;

    @Override
    public PageInfo<FinanceModel> detailed(FinanceModel financeModel) {
        int page=financeModel.getPage();
        int limit=financeModel.getLimit();
        PageHelper.startPage(page,limit);
        PageInfo<FinanceModel> financeModelPageInfo = new PageInfo<>(financeDao.detailed(financeModel));
        return financeModelPageInfo;
    }

    @Override
    public List<FinanceModel> monthlyReport(FinanceModel financeModel) {
        return financeDao.monthlyReport(financeModel);
    }

    @Override
    public List<FinanceModel> annualReport(FinanceModel financeModel) {
        return financeDao.annualReport(financeModel);
    }


    @Override
    public PageInfo<FinanceModel> annualFindAll(FinanceModel financeModel) {
        int page=financeModel.getPage();
        int limit=financeModel.getLimit();
        PageHelper.startPage(page,limit);
        PageInfo<FinanceModel> financeModelPageInfo = new PageInfo<>(financeDao.annualFindAll(financeModel));
        return financeModelPageInfo;
    }

    @Override
    public PageInfo<FinanceModel> monthlyFindAll(FinanceModel financeModel) {
        int page=financeModel.getPage();
        int limit=financeModel.getLimit();
        PageHelper.startPage(page,limit);
        PageInfo<FinanceModel> financeModelPageInfo = new PageInfo<>(financeDao.monthlyFindAll(financeModel));
        return financeModelPageInfo;
    }
}
